package com.sky.mapper;

import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author 梁科
 * @Version 1.0
 * @ Date 2025/10/21 18:20
 */
@Mapper
public interface SetmealDishMapper {
    /**
     * 根据dish_id查找setmeal_id
     * @param ids
     * @return
     */
    List<Long> getByDishId(List<Long> ids);

    /**
     * 根据套餐id查找SetmealDish信息
     * @param setmealId 套餐id
     * @return
     */
    @Select(value = "select * from setmeal_dish where setmeal_id = #{setmealId}")
    List<SetmealDish> getBySetmealId(Long setmealId);

    /**
     * 批量增加SetmealDish表（菜品表与套餐表的关联表）
     * @param setmealDishes
     */
    void batchAdd(List<SetmealDish> setmealDishes);

    /**
     * 根据套餐id删除关系表对应的数据
     * @param id
     */
    @Delete(value = "delete from setmeal_dish where setmeal_id = #{id}")
    void deleteBySetmealId(Long id);

    /**
     * 批量删除菜品套餐关系表
     * @param setmealIds
     */
    void delete(List<Long> setmealIds);
}
